package cn.iocoder.devlop.module.annual.report.overduepay.controller.app;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;

import cn.iocoder.devlop.framework.common.pojo.PageResult;
import cn.iocoder.devlop.framework.common.pojo.CommonResult;
import static cn.iocoder.devlop.framework.common.pojo.CommonResult.success;

import cn.iocoder.devlop.framework.excel.core.util.ExcelUtils;

import cn.iocoder.devlop.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.devlop.framework.operatelog.core.enums.OperateTypeEnum.*;

import cn.iocoder.devlop.module.annual.report.overduepay.controller.vo.*;
import cn.iocoder.devlop.module.annual.report.overduepay.dal.dataobject.OverduepayDO;
import cn.iocoder.devlop.module.annual.report.overduepay.convert.OverduepayConvert;
import cn.iocoder.devlop.module.annual.report.overduepay.service.OverduepayService;

@Tag(name = "用户 APP - 逾期尚未支付款项信息")
@RestController
@RequestMapping("/annual/report/overduepay")
@Validated
public class AppOverduepayController {

    @Resource
    private OverduepayService overduepayService;

    @GetMapping("/list")
    @Operation(summary = "获得年报逾期尚未支付款项信息列表")
    public CommonResult<List<OverduepayRespVO>> getOverduepayList(@RequestParam("regno") String regno, @RequestParam("ancheyear") String ancheyear) {
        List<OverduepayDO> list = overduepayService.getOverduepayList(regno, ancheyear);
        return success(OverduepayConvert.INSTANCE.convertList(list));
    }

    @PutMapping("/overwrite")
    @Operation(summary = "覆盖更新年报逾期尚未支付款项信息列表")
    public CommonResult<Boolean> overwriteOverduepay(@Valid @RequestBody OverduepayOverwriteVO updateReqVO) {
        overduepayService.overwriteOverduepay(updateReqVO);
        return success(true);
    }
}
